package com.spring.annotation.example.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

//等价于: <bean id="user"  class="com.spring.annotation.example.pojo.User"/>
@Component
@Scope("singleton")
public class User {
    private String name;

    public String getName() {
        return name;
    }

//相当于: <property name="name" value="Jack"/>
    @Value("Jack")
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                '}';
    }
}
